package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.SysApiLog;
import com.example.mapper.SysApiLogMapper;
import com.example.service.SysApiLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * API请求日志 服务实现类
 */
@Slf4j
@Service
public class SysApiLogServiceImpl extends ServiceImpl<SysApiLogMapper, SysApiLog> implements SysApiLogService {

    /**
     * 异步保存API日志
     *
     * @param apiLog API日志信息
     * @return 结果
     */
    @Async
    @Override
    public boolean saveApiLog(SysApiLog apiLog) {
        try {
            return save(apiLog);
        } catch (Exception e) {
            log.error("保存API日志出错", e);
            return false;
        }
    }
} 